home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ9212.ZIP / strupro.asc < prev    next >
Text File  |  1992-11-30  |  2KB  |  55 lines

  1. _STRUCTURED PROGRAMMING_
  2. by Jeff Duntemann
  3.  
  4. [LISTING ONE]
  5.  
  6. PROCEDURE TMortgageView.ExtraPrincipalRange;
  7.  
  8. VAR
  9.   ExtraRangeDialog   : PDialog;
  10.   ExtraPrincipalData : ExtraPrincipalRangeDialogData;
  11.   FromPaymentLine,
  12.   ToPaymentLine,
  13.   DollarsInputLine   : PFinputLine;
  14.   R       : TRect;
  15.   Control : Word;
  16.   View    : PView;
  17.  
  18. BEGIN
  19.   { Instantiate the resource-based EXTRA_RANGE dialog box from MORTGAGE.BRS:}
  20.   ExtraRangeDialog := PDialog(bAppResFile.Get('EXTRA_RANGE'));
  21.  
  22.   { Create and shoehorn the three FInputLine controls: }
  23.   R.Assign(0,0,0,0);
  24.   DollarsInputLine := New(PFinputLine,Init(R,8,DRealSet,DReal,2));
  25.   View := bShoeHorn(ExtraRangeDialog,DollarsInputLine);
  26.  
  27.   ToPaymentLine    := New(PFInputLine,Init(R,3,DUnSignedSet,DInteger,0));
  28.   View := bShoeHorn(ExtraRangeDialog,ToPaymentLine);
  29.  
  30.   FromPaymentLine  := New(PFInputLine,Init(R,3,DUnSignedSet,DInteger,0));
  31.   View := bShoeHorn(ExtraRangeDialog,FromPaymentLine);
  32.  
  33.   { Set the default values for the dialog through SetData: }
  34.   ExtraPrincipalData.FromPaymentNumber := 0;
  35.   ExtraPrincipalData.ToPaymentNumber   := 0;
  36.   ExtraPrincipalData.ExtraDollars      := 0.00;
  37.   ExtraRangeDialog^.SetData(ExtraPrincipalData);
  38.   Control := Desktop^.ExecView(ExtraRangeDialog);
  39.  
  40.   IF Control <> cmCancel THEN  { Update the active mortgage window: }
  41.     BEGIN
  42.       { Get data from the extra principal dialog: }
  43.       ExtraRangeDialog^.GetData(ExtraPrincipalData);
  44.       WorkingBox^.Show;
  45.       WITH ExtraPrincipalData DO
  46.         Mortgage.RangeExtraPrincipal(FromPaymentNumber,
  47.                                      ToPaymentNumber,
  48.                                      ExtraDollars);
  49.       WorkingBox^.Hide;
  50.       Redraw;            { Redraw the mortgage window     }
  51.     END;
  52.   Dispose(ExtraRangeDialog,Done);
  53. END;
  54.  
  55.